<template>
  <div class="error-page">
    <!-- 动态背景 -->
    <div class="animated-bg">
      <div class="shape shape-1"></div>
      <div class="shape shape-2"></div>
      <div class="shape shape-3"></div>
      <div class="shape shape-4"></div>
    </div>

    <!-- 导航栏 -->
    <nav class="navbar">
      <div class="nav-brand">
        <div class="logo">
          <span class="logo-icon">F</span>
        </div>
        <span class="brand-name">Front_Yue</span>
      </div>
      <div class="nav-actions">
        <el-button type="primary" class="login-btn" @click="goHome">
          返回首页
        </el-button>
      </div>
    </nav>

    <!-- 错误内容 -->
    <div class="error-content">
      <div class="error-container">
        <div class="error-code">404</div>
        <div class="error-title">页面不存在</div>
        <div class="error-message">您访问的页面可能已被移除、更名或暂时不可用</div>
        <div class="error-actions">
          <el-button type="primary" class="home-btn" @click="goHome">返回首页</el-button>
          <el-button class="back-btn" @click="goBack">返回上一页</el-button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
// 设置响应状态码为404
// definePageMeta({
//   validate: () => true
// });

// // 设置页面的HTTP状态码为404
// if (process.server) {
//   const event = useRequestEvent();
//   if (event) {
//     event.node.res.statusCode = 404;
//   }
// }

// 设置页面标题
useHead({
  title: '404 - 页面不存在'
});

const router = useRouter();

const goHome = () => {
  router.push('/');
};

const goBack = () => {
  router.back();
};
</script>

<style lang="scss" scoped>
.error-page {
  min-height: 100vh;
  background: #13151f;
  color: #fff;
  position: relative;
  overflow-x: hidden;
}

// 动态背景 - 与index.vue保持一致
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
  
  .shape {
    position: absolute;
    border-radius: 50%;
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    filter: blur(60px);
    opacity: 0.4;
    animation: float 15s infinite ease-in-out;
    will-change: transform;
    transform: translateZ(0);
    
    &.shape-1 {
      width: 400px;
      height: 400px;
      top: -100px;
      right: -100px;
      animation-delay: 0s;
    }
    
    &.shape-2 {
      width: 300px;
      height: 300px;
      bottom: -80px;
      left: -80px;
      background: linear-gradient(45deg, #3b82f6, #06b6d4);
      animation-delay: -5s;
    }
    
    &.shape-3 {
      width: 200px;
      height: 200px;
      bottom: 30%;
      right: 10%;
      background: linear-gradient(45deg, #ec4899, #8b5cf6);
      animation-delay: -10s;
    }
    
    &.shape-4 {
      width: 250px;
      height: 250px;
      top: 20%;
      left: 10%;
      background: linear-gradient(45deg, #10b981, #3b82f6);
      animation-delay: -15s;
    }
  }
}

@keyframes float {
  0% {
    transform: translate(0px, 0px) rotate(0deg);
  }
  25% {
    transform: translate(20px, -20px) rotate(5deg);
  }
  50% {
    transform: translate(0px, 10px) rotate(0deg);
  }
  75% {
    transform: translate(-20px, -10px) rotate(-5deg);
  }
  100% {
    transform: translate(0px, 0px) rotate(0deg);
  }
}

// 导航栏
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 100;
  
  .nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    
    .logo {
      width: 40px;
      height: 40px;
      background: linear-gradient(45deg, #6366f1, #8b5cf6);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      
      .logo-icon {
        color: white;
        font-size: 20px;
        font-weight: 700;
      }
    }
    
    .brand-name {
      font-size: 24px;
      font-weight: 600;
      color: #fff;
    }
  }
  
  .nav-actions {
    .login-btn {
      background: linear-gradient(90deg, #6366f1, #8b5cf6);
      border: none;
      border-radius: 8px;
      padding: 8px 24px;
      font-weight: 500;
      transition: all 0.3s ease;
      
      &:hover {
        background: linear-gradient(90deg, #4f46e5, #7c3aed);
        transform: translateY(-2px);
        box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
      }
    }
  }
}

// 错误内容
.error-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  position: relative;
  z-index: 10;
}

.error-container {
  max-width: 600px;
  text-align: center;
  animation: fadeIn 1s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.error-code {
  font-size: 8rem;
  font-weight: 800;
  margin-bottom: 1rem;
  background: linear-gradient(45deg, #6366f1, #8b5cf6, #ec4899);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1;
  text-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.error-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #fff;
}

.error-message {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 2rem;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  
  .home-btn {
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 500;
    transition: all 0.3s ease;
    
    &:hover {
      background: linear-gradient(90deg, #4f46e5, #7c3aed);
      transform: translateY(-2px);
      box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
    }
  }
  
  .back-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    padding: 12px 24px;
    font-weight: 500;
    transition: all 0.3s ease;
    
    &:hover {
      background: rgba(255, 255, 255, 0.2);
      transform: translateY(-2px);
    }
  }
}

// 响应式设计
@media (max-width: 768px) {
  .error-code {
    font-size: 6rem;
  }
  
  .error-title {
    font-size: 2rem;
  }
  
  .error-message {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .error-code {
    font-size: 4rem;
  }
  
  .error-title {
    font-size: 1.5rem;
  }
  
  .error-actions {
    flex-direction: column;
  }
}
</style> 